package com.chinasoft.carservice.controller;


import com.chinasoft.carservice.service.CarService;
import com.chinasoft.ms.dto.CarDTO;
import com.chinasoft.ms.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class CarMicroController {

    @Autowired
    CarService carService;

    @PutMapping("/status/{carId}")
    boolean updateCarStatus(@PathVariable("carId") Long CarId, @RequestParam String s) {
        System.out.println("CarId:" + CarId);
        boolean success = carService.updateStatus(CarId,s);
        return success ? true  : false;
    }

    @GetMapping("/car/{carId}")
    public CarDTO selectById(@PathVariable("carId") Long CarId) {
        return carService.selectCarById(CarId);
    }
}
